/*****************************************************************
 MYD Engine v0.1

 file: myd_game.h
 Created: 18/06/09
*****************************************************************/
#ifndef MYD_GAME_H
#define MYD_GAME_H

#include "system/myd_system.h"
#include "entities/myd_entity.h"
#include "physics/myd_physics.h"
#include "input/myd_directInput.h"
#include "3Dentities/myd_camera.h"

namespace myd
{
	class Renderer;
	class Window;
	class Importer;
	class Timer;

	class MYD_API Game
	{
		public:
			//contructer-destructer	
			Game(HINSTANCE hInstance);
			virtual ~Game();

			void addEntity(Entity* tm_entity);
			void setViewPosition(float x, float y);

			//classic loop methods
			bool init();
			bool loop();
			bool deinit();

			//resources
			Importer* getImporter();

		protected:
			//application specific steps
			virtual bool onInit() = 0;
			virtual bool onLoop() = 0;
			virtual bool onDeinit() = 0;

			void sortEntitiesByDepth(void);
			static bool Zcompare(Entity *entity1, Entity *entity2);

			//engine objects
			Renderer *wn_renderer;
			Importer *wn_importer;
			Timer *wn_timer;
			Physics physics;
			
			//input
			DirectInput *input;

		private:
			//entities
			std::vector<Entity*> wn_entities;
			
			//Windows stuff
			HINSTANCE m_hInstance;

			HWND hWnd;

			//engine stuff
			Window* wn_window;

			//camera
		protected:
			Camera wn_camera;
			D3DXVECTOR3 handyv3;
	};
	#include "myd_game.inl"
}//end namespace
#endif //MYD_GAME_H
